package com.acme.bankapp.domain.accounting;


/**
 * Account without overdraft
 *
 */
public class SavingAccount extends AbstractAccount {
	
	public SavingAccount(double balance) {
		super(balance);
	}
	

	/**
	 * {@inheritDoc}
	 */
	@Override
	public double maximumAmountToWithdraw() {
		return balance;
	}


	@Override
	/** 
	 * {@inheritDoc}
	 */
	public void withdraw(double x) throws LowBalanceException{
		if(balance >= x){
			balance -= x;
		}else{
			throw new LowBalanceException(balance, x);
		}
	}

}
